﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ins = LEET.StandardModuals.Instructions;
using LEET.LEETCommon;
using LEET.CommonInterfaces.TestControls;
using System.Windows.Automation;
using Compiled_Tests;

namespace LEET.StandardModuals.Instructions.Actions
{
    public class Close : Ins.Action
    {
        public Close(String[] args)
            : base(args)
        {
            InstructionType = NodeTypes.CLOSE_ACTION_TYPE;
        }

        public static IAutomationActionResult StaticCall(IBox box)
        {
            Object obj;
            box.RootElement.TryGetCurrentPattern(WindowPattern.Pattern, out obj);
            WindowPattern pattern = obj as WindowPattern;
            if (pattern != null)
                pattern.Close();
            return new AutomationActionResult();
        }

        public override String RenderStaticCall()
        {
            return "LEET.StandardModuals.Instructions.Actions.Close.StaticCall(Box)";
        }

        

        public override string PlainText()
        {
            return "Closed the window we were watching.";
        }
    }
}
